home *** CD-ROM | disk | FTP | other *** search
/ Champak 128 / Vol 128 (Damaged).iso / games / boiler_b.swf / scripts / DefineSprite_198 / frame_1 / DoAction.as
Encoding:
Text File  |  2011-03-26  |  1.1 KB  |  57 lines

  1. var pState;
  2. var pX;
  3. var pY;
  4. var pNum;
  5. var pNum = Number(this._name.slice(6,-3));
  6. this.setPos = function(ty)
  7. {
  8.    this._x = pX + 38;
  9.    this._y = pY - ty;
  10. };
  11. this.activate = function()
  12. {
  13.    var _loc1_ = this;
  14.    trace("activated: " + pObj);
  15.    _loc1_.pState = "active";
  16.    _loc1_.gotoAndStop(_loc1_.pObj + "_active");
  17. };
  18. this.collect = function()
  19. {
  20.    var _loc1_ = this;
  21.    if(_loc1_.pState == "active")
  22.    {
  23.       _loc1_._parent.snd_mc.playsound("pFix");
  24.       _loc1_.pState = "collected";
  25.       _loc1_._parent.top_mc.addTarget();
  26.       _loc1_._parent.obj_mc.activate();
  27.       trace("collected: " + pObj);
  28.       _loc1_.gotoAndStop(_loc1_.pObj + "_done");
  29.    }
  30. };
  31. this.setUp = function(x, y, tobj)
  32. {
  33.    var _loc1_ = this;
  34.    _loc1_.pX = x * 16;
  35.    _loc1_.pY = y * 16;
  36.    _loc1_.pObj = tobj;
  37.    _loc1_.gotoAndStop(tobj);
  38. };
  39. switch(pNum)
  40. {
  41.    case 0:
  42.       this.setUp(8,125,"screw");
  43.       break;
  44.    case 1:
  45.       this.setUp(33,7,"fuse");
  46.       break;
  47.    case 2:
  48.       this.setUp(31,53,"nozzle");
  49.       break;
  50.    case 3:
  51.       this.setUp(12,56,"nut");
  52.       break;
  53.    case 4:
  54.       this.setUp(37,83,"spring");
  55. }
  56. stop();
  57.